using System;
using System.Collections.Generic;
using System.Text;
using Madason.MetaModel.Validation;

namespace Madason.MetaModel.DAO
{
	public class PrimaryKeyAttribute : PersistedAttribute
	{
		public const string ERROR_UNSUPPORTED_TYPE = "The datatype {0} is not supported for primary key attribute";

		public override void Validate(Madason.MetaModel.Validation.ValidationIssueList issues)
		{
			base.Validate(issues);
			
			if (Type.Name != "int" && Type.Name != "string" && Type.Name != "String")
			{
				issues.Add(
					new ValidationIssue(
					String.Format(ERROR_UNSUPPORTED_TYPE, Type.Name), ValidationIssueSeverity.Error, this));
			}			 
		}
	}
}
